import Vue from 'vue'
import VueCompositionAPI from '@vue/composition-api'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
// 移除particles和kinesis的相关导入
import VueTippy from 'vue-tippy'
import 'tippy.js/dist/tippy.css'
import 'tippy.js/themes/light.css'
import 'tippy.js/themes/light-border.css'
import 'tippy.js/themes/material.css'
import 'tippy.js/themes/translucent.css'

// 导入vue-echarts
import ECharts from 'vue-echarts'
// 导入echarts
import echarts from 'echarts'

// 使用Vue Composition API (必须在vue-echarts之前)
Vue.use(VueCompositionAPI)

// 全局注册组件
Vue.component('v-chart', ECharts)
// 移除kinesis组件注册

Vue.config.productionTip = false

// 配置axios
axios.defaults.baseURL = '' // 使用相对路径，通过vue.config.js中的代理配置处理
axios.defaults.timeout = 15000 // 设置超时时间
Vue.prototype.$http = axios
Vue.prototype.$echarts = echarts // 将echarts挂载到Vue原型上

// 添加请求拦截器
axios.interceptors.request.use(config => {
  console.log('发送请求:', config.url)
  return config
}, error => {
  return Promise.reject(error)
})

// 添加响应拦截器
axios.interceptors.response.use(response => {
  console.log('收到响应:', response.config.url, response.status)
  return response
}, error => {
  console.error('请求错误:', error)
  return Promise.reject(error)
})

// 使用ElementUI
Vue.use(ElementUI)

// 使用VueTippy
Vue.use(VueTippy, {
  directive: 'tippy', // 默认
  theme: 'translucent',
  arrow: true,
  animation: 'shift-away',
  placement: 'top',
  duration: [275, 200],
  allowHTML: true,
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app') 